package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.common.utils.BeanUtils;
import com.atguigu.spzx.manager.mapper.SysOperLogMapper;
import com.atguigu.spzx.common.entity.SysOperLog;
import com.atguigu.spzx.manager.service.SysOperLogService;
import com.atguigu.spzx.manager.vo.sysOperLog.SysOperLogQueryReqVo;
import com.atguigu.spzx.manager.vo.sysOperLog.SysOperLogQueryRespVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * OperLogServiceImpl
 * </p>
 *
 * @author flyduck
 * @since 2023/10/26
 */
@Service
public class SysOperLogServiceImpl implements SysOperLogService {

    @Autowired
    private SysOperLogMapper sysOperLogMapper;

    /**
     * 获取分页列表
     * @param pageParam
     * @param sysOperLogQueryVo
     * @return
     */
    @Override
    public Page<SysOperLogQueryRespVo> getOperLogPageByQuery(Page<SysOperLog> pageParam, SysOperLogQueryReqVo sysOperLogQueryVo) {
        return sysOperLogMapper.getOperLogPageByQuery(pageParam,sysOperLogQueryVo);
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    public SysOperLogQueryRespVo getOperLogById(Long id) {
        SysOperLog sysOperLog = sysOperLogMapper.selectById(id);
        return BeanUtils.toBean(sysOperLog, SysOperLogQueryRespVo.class);
    }
}
